<html>

<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>UDT Reference</title>
</head>

<body>

<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="100%" id="table1" bgcolor="#99CCFF" bordercolor="#99CCFF">
  <tr>
    <td width="100%"><font face="Verdana" size="2"><i>&nbsp;UDT </i></font><i>
	<font face="Verdana" size="2">Tutorial</font></i></td>
  </tr>
</table>
<h1><font face="Verdana" size="4">Configurate the UDT options</font></h1>
<p><font face="Verdana" size="2">Options of UDT are read and set through
<a href="opt.htm">getsockopt</a> and <a href="opt.htm">setsockopt</a> methods. Before modifying any option, bear in mind that 
it is NOT required that you modify the default options. If the application has sound performance with 
the default options, just leave them alone.</font></p>
<p><font face="Verdana" size="2">UDT_MSS is used to configure the packet size. 
On most of time, the optimal UDT packet size is the network MTU size. The 
default value is 1500 bytes. A UDT connection will choose the smaller value of 
the MSS between the two peer sides. For example, if you want to set 9000-byte 
MSS, you have to set this option at both sides, and the one of the value has to 
be exactly equal to 9000, and the other must not be less than 9000.</font></p>
<p><font face="Verdana" size="2">UDT uses a different semantics of 
synchronization mode from traditional sockets. It can set the sending and 
receiving synchronization independently, which allows more flexibility. However, 
UDT does not allow non-blocking operation on connection setup and close.</font></p>
<font face="Verdana" size="2">
<p>The UDT buffer size is used to limit the size of temporary storage of 
sending/receiving data. The sending buffer size is only a limit. Memory is 
allocated upon necessary. The receiving buffer is statically allocated and the 
same amount of memory is allocated to the UDT throughout the UDT life. 
Generally, larger buffer (but not so large that the physical memory is used up) 
is better for performance the the buffer sizes for both sides should be at least 
Bandwidth*RTT.</p>
<p>UDT uses UDP as the data channel, so the UDP buffer size affects the performance. 
Again, a larger value is generally better, but the effects become smaller and 
disappear as the buffer size increases. Generally, the sending buffer size can be 
a small value, because it does not limit the packet sending much but a large 
value will increase the delay. On the other hand, the receiving buffer size 
should not be less than the UDT receiver buffer size, in order that the flow 
control is effective.</p>
<p>UDT_FC is actually an internal parameter and you should set it to not less 
than UDT_RCVBUF/UDT_MSS.</p>
<p>UDT_LINGER is similar to the SO_LINGER option on the regular sockets.</p>
<p>UDT_RENDEZVOUS is used to enable rendezvous connection setup.</p>
<p>UDT_SNDTIMEO and UDT_RCVTIMEO are similar to SO_SNDTIMEO and SO_RCVTIMEO, 
respectively.</p>
<p style="margin-top: 0; margin-bottom: 0"><b>Example: read current UDT settings</b></p>
<p style="margin-top: 0; margin-bottom: 0">&nbsp;</p>
<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="100%" id="table2" bgcolor="#C0C0C0" bordercolor="#C0C0C0">
  <tr>
    <td width="100%">
    <p style="margin-top: 0; margin-bottom: 0">
    <font size="1" face="Courier New">UDTSOCKET u;</font></p>
	<p style="margin-top: 0; margin-bottom: 0">
    <font face="Courier New" size="1">...</font></p>
    <p style="margin-top: 0; margin-bottom: 0">
    <font face="Courier New" size="1">bool block;</font></p>
    <p><font face="Courier New" size="1">UDT::getsockopt(u, UDT_SNDSYN, 0, &amp;block, sizeof(bool));</font></td>
  </tr>
</table>
<p style="margin-top: 0; margin-bottom: 0">&nbsp;</p>
<p style="margin-top: 0; margin-bottom: 0"><b>Example: modify UDT settings</b></p>
<p style="margin-top: 0; margin-bottom: 0">&nbsp;</p>
<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="100%" id="table3" bgcolor="#C0C0C0" bordercolor="#C0C0C0">
  <tr>
    <td width="100%">
    <p style="margin-top: 0; margin-bottom: 0">
    <font size="1" face="Courier New">UDTSOCKET u;</font></p>
	<p style="margin-top: 0; margin-bottom: 0">
    <font face="Courier New" size="1">...</font></p>
    <p style="margin-top: 0; margin-bottom: 0">
    <font face="Courier New" size="1">bool block = false;</font></p>
    <p><font face="Courier New" size="1">UDT::setsockopt(u, UDT_SNDSYN, 0, &amp;block, sizeof(bool));</font></td>
  </tr>
</table>

</body>

</html>
